# Contributor: Sam Dodrill <shadowh511@gmail.com>
# Contributor: TBK <alpine@jjtc.eu>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=py3-virtualenv
pkgver=20.25.1
pkgrel=2
pkgdesc="Virtual Python3 Environment builder"
url="https://virtualenv.pypa.io/en/latest/"
arch="noarch"
license="MIT"
depends="py3-platformdirs py3-distlib py3-filelock"
makedepends="
	py3-gpep517
	py3-hatchling
	py3-hatch-vcs
	py3-wheel
	"
checkdepends="
	py3-flaky
	py3-pytest-env
	py3-pytest-mock
	py3-pytest-timeout
	py3-pytest-xdist
	py3-time-machine
	python3-dev
	"
subpackages="$pkgname-pyc"
source="https://files.pythonhosted.org/packages/source/v/virtualenv/virtualenv-$pkgver.tar.gz"
builddir="$srcdir/virtualenv-$pkgver"

replaces="py-virtualenv" # Backwards compatibility
provides="py-virtualenv=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest -n auto -v \
		-k "not test_can_build_c_extensions"
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl
}

sha512sums="
c0791de2aed7893658316199696906b1aed650460f3b53e0dbd13e695d16bc14d8974cd72fc8dcc010ff7ba10036121929ce9a608f97d7d2cd9f972144a3a1f0  virtualenv-20.25.1.tar.gz
"
